home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
FORTRAN1.LZH
/
GETFOR.FOR
< prev
next >
Wrap
Text File
|
1988-02-08
|
4KB
|
149 lines
SUBROUTINE GETFOR ( NQ, QUALS, NP, PARAMS )
C*
C* *******************************
C* *******************************
C* ** **
C* ** GETFOR **
C* ** **
C* *******************************
C* *******************************
C*
C* SUBPROGRAM :
C* GET FOREIGN
C*
C* AUTHOR :
C* ART RAGOSTA
C* MS 207-5
C* AMES RESEARCH CENTER
C* MOFFETT FIELD, CALIF 94035
C* (415)694-5578
C*
C* PURPOSE :
C* TO RETURN ANY PARAMETERS AND/OR QUALIFIERS ENTERED ON A FORE
C* COMMAND LINE.
C*
C* METHODOLOGY :
C* USE VMS GET_FOREIGN ROUTINE THEN PARSE USING ' ' AND '/'
C* AS VALID DELIMITERS.
C*
C* INPUT ARGUMENTS :
C* NONE
C*
C* OUTPUT ARGUMENTS :
C* NQ - NUMBER OF QUALIFIERS FOUND
C* QUALS - THE LIST OF QUALIFIERS(LESS SLASH/
C* NP - NUMBER OF PARAMETERS FOUND
C* PARAMS - THE LIST OF PARAMETERS
C*
C* INTERNAL WORK AREAS :
C* NONE
C*
C* COMMON BLOCKS :
C* NONE
C*
C* FILE REFERENCES :
C* NONE
C*
C* DATA BASE ACCESS :
C* NONE
C*
C* SUBPROGRAM REFERENCES :
C* LIB$GET_FOREIGN
C*
C* ERROR PROCESSING :
C* NONE
C*
C* TRANSPORTABILITY LIMITATIONS :
C* UNLIKELY TO BE TRANSPORTABLE TO ANY SYSTEM BUT VMS.
C*
C* ASSUMPTIONS AND RESTRICTIONS :
C* BLANKS CAN BE USED ONLY AS DELIMITERS.
C*
C* LANGUAGE AND COMPILER :
C* ANSI FORTRAN 77
C*
C* VERSION AND DATE :
C* VERSION I.0 24-JAN-85
C*
C* CHANGE HISTORY :
C* 24-JAN-85 INITIAL VERSION
C*
C***********************************************************************
C*
CHARACTER *80 COMMAN
CHARACTER *(*) QUALS(1),PARAMS(1)
EXTERNAL SS$_NORMAL
C
IP = 0
NQ = 0
NP = 0
LS = LEN(QUALS(1))
C
C --- RETURN COMMAND LINE (LESS FOREIGN COMMAND)
C
ISTAT = LIB$GET_FOREIGN(COMMAN,,IP)
IF (ISTAT .NE. %LOC(SS$_NORMAL))RETURN
IF (IP .LE. 0 )RETURN
I = 1
C
C --- LOOP WHILE LINE STILL HAS CHARACTERS IN IT
C
100 IF ( COMMAN(I:I) .EQ. '/' ) THEN
C
C --- A QUALIFIER... GET FIRST, NON-BLANK CHARACTER
C
105 I = I + 1
IF (COMMAN(I:I) .EQ. ' ') THEN
IF (I .GE. IP) GO TO 300
GO TO 105
ENDIF
NQ = NQ + 1
NC = 1
QUALS(NQ) = ' '
C
C ---- ADD CHARACTERS UNTIL A SPACE OR SLASH FOUND, OR END OF LINE
C
110 IF ((COMMAN(I:I) .EQ. ' ') .OR. (COMMAN(I:I) .EQ. '/'))
$ GO TO 120
IF (NC .LE. LS ) QUALS(NQ)(NC:NC) = COMMAN(I:I)
I = I + 1
NC = NC + 1
GO TO 110
120 IF (COMMAN(I:I) .EQ. ' ') THEN
I = I + 1
IF (I .GT. IP) GO TO 300
GO TO 120
ENDIF
GO TO 100
ELSE
C
C --- PARAMETER... FIRST CHARACTER IS ALREADY NON-BLANK
C
NP = NP + 1
NC = 1
PARAMS(NP) = ' '
C
C --- ADD CHARACTERS UNTIL A BLANK OR SLASH IS FOUND
C
210 IF ((COMMAN(I:I) .EQ. ' ') .OR. (COMMAN(I:I) .EQ. '/'))
$ GO TO 220
IF (NC .LE. LS) PARAMS(NP)(NC:NC) = COMMAN(I:I)
I = I + 1
NC = NC + 1
GO TO 210
220 IF (COMMAN(I:I) .EQ. ' ') THEN
I = I + 1
IF (I .GT. IP) GO TO 300
GO TO 220
ENDIF
GO TO 100
ENDIF
C
C --- END OF LOOP WHILE LINE STILL HAS CHARACTERS
C
300 RETURN
END
C
C---END GETFOR
C